package core;

import java.awt.Graphics2D;
import java.util.Iterator;
import java.util.Vector;

import utils.DBG;
import utils.FPSWidget;
import core.rendering.Renderable;

public class Renderer {

	Vector<Renderable> renderables;
	Graphics2D g2d;
	FPSWidget fps;
	Iterator<Renderable> it;
	boolean setted = false;

	public Renderer() {
		fps = new FPSWidget();
		renderables = new Vector();
		DBG.showMsg("Creado un Renderer con Graphics2D", this);
		 
	}

	public void addElement(Renderable rend) {
		DBG.showMsg("Added renderable", rend);
		renderables.add(rend);
	}

	public void render() {

		it = renderables.iterator();
		
		while (it.hasNext()) {
			it.next().render(g2d);
		}
		fps.render(g2d);
		// DBG.showMsg("Rendering", this);
	}

}
